const requireDictModules = import.meta.glob('./**/*.js', { eager: true, import: 'default' })

export default {
  async install(app) {
    const res = await window.$apis.getDict()
    for (const path in requireDictModules) {
      const modules = requireDictModules[path]
      app.config.globalProperties.$dict = {
        ...app.config.globalProperties.$dict,
        ...modules
      }
    }
    window.$dict = {
      ...app.config.globalProperties.$dict,
      ...res
    }
  }
}
